package com.wxiao.exam.controller.manager;

import com.wxiao.exam.PageBean;
import com.wxiao.exam.StudentService;
import com.wxiao.exam.pojo.vo.StudentListVO;
import com.wxiao.exam.pojo.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/admin/student")
public class ManageStudentController {

    @Value("#{properties['student.pageSize']}")
    int pageSize=5;

    @Value("#{properties['student.navigatePages']}")
    int size=5;

    @Autowired
    StudentService studentService;


    @RequestMapping("/list")
    public String list(StudentVO studentVO, Model model, String search){
        model.addAttribute("function",5);
        studentVO.setPageSize(pageSize);
        studentVO.setSize(size);
        studentVO.setName(search);
        PageBean<StudentListVO> pageBean = studentService.listStudentByPage(studentVO);
        model.addAttribute("pageBean",pageBean);
        model.addAttribute("search",studentVO.getName());
        return "admin/student_list";
    }

}
